<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <meta name="author" content="纪德朝">
    <title>倒计时</title>
    <style>
        div {
            width: 500px;
            margin: 100px auto;
        }

        input {
            width: 80px;
        }

        button {
            /* margin-left: 10px; */
            width: 100px;
        }
    </style>
</head>

<body>
    <div>
        <input type="text" placeholder="请输入1-60" class="second">分钟
        <input type="text" placeholder="请输入1-60" class="three">秒
        <br>
        <button onclick="start()" class="one">开始计时</button>
         <button onclick="stop()" class="two">暂停计时</button> 
    </div>
</body>
<script>
    var second = document.querySelector('.second');
    var three = document.querySelector('.three');


    var timer;
    var a = true;
    function start() {
        timer = setInterval(function () {
            var se = three.value;
            var min = second.value;
            if (se > 0) {
                se -= 1;
            } else {
                se = 60;
                min -= 1;
            }
            three.value = se;
            second.value = min;
            if (se == 0 && min == 0) {
                clearInterval(timer);
            }
        }, 1000);
    }
    function stop() {      
        clearInterval(timer);
    }

</script>

</html>